{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">管理日志</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
    </div>
</div>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <!--<button class="layui-btn layui-btn-sm layui-btn-danger confirm layui-batch-all" data-field-id="id" data-href='{:url("delete")}'>批量删除</button>-->
        <button class="layui-btn layui-btn-sm layui-btn-danger confirm ajax-get" data-href="{:url('deletelog')}">删除一个月前日志</button>
    </div>
</script>
<script type="text/html" id="barTool">
    <a href='{:url("delete")}?ids={{ d.id }}' class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>
</script>
{/block}
{block name="script"}
<script>
    var options = {
        id: 'dataTable',
        formId: 'searchForm',
        toolbar: '#toolbarDemo',
        url: '{:url("admin/adminlog/index")}',
        page: true,   //分页设置
        sortOrder: '', //排序方式  asc: 升序、desc: 降序、null: 默认排序
        cols: [
            [
                /*{ type: 'checkbox', fixed: 'left' },*/
                { field: 'id', width: 80, title: 'ID', sort: true },
                { field: 'uid', width: 80, title: '用户ID' },
                { field: 'info', title: '提示' },
                { field: 'get', title: '操作URL' },
                { field: 'create_time', width: 180, title: '时间' },
                { field: 'ip', width: 120, title: 'IP' },
                { field: 'status', width: 80, title: '状态',align: "center", templet: '<div>{{#  if(d.status){ }} <button class="layui-btn layui-btn layui-btn-xs">成功</button> {{#  } else { }} <button class="layui-btn layui-btn-danger layui-btn layui-btn-xs">失败</button> {{#  } }} </div>' },
                /*{ fixed: 'right', width: 100, title: '操作', toolbar: '#barTool' },*/
            ]
        ],
        done: function(res, curr, count){}, //表格数据渲染完的回调
    };
    // 搜索
    options.searchParams = function(){
        var formData = $.table._searchFormData();
        var data = {};
        data = $.extend(formData, data);
        return data;
    };
    // 加载layui表格
    $.table.init(options);
</script>
{/block}